package Algorithm.LeetCode;

import java.util.Arrays;

public class number02 {
    public static void main(String[] args) {
        int num =695;
        Solution02 solution = new Solution02();
        Integer x=solution.reverse(num);
        System.out.println(x);
    }
}
class Solution02 {
    public int reverse(int x) {
        String str = String.valueOf(x);
        String[] strings = str.split("");
        System.out.println(Arrays.toString(strings));
        if (strings[0] == "-".toString()) {
            for (int i = str.length()-1; i >0; i--) {
                str+=strings[i];
            }
            x=Integer.parseInt(str);
            x=x*-1;
        }else {
            str="";
            for (int i=strings.length-1;i>=0;i--){
                str+=strings[i];
            }
            x=Integer.parseInt(str);
        }
        return x;
    }
}
